const router = require('express').Router()

const { list, add, remove, info, update } = require('../controllers/banner')


const { testAdd } = require('../middleware/banner')

const { testId } = require('../middleware/users')

const { bannerUpload } = require('../utils/multer')
// 获取轮播图列表
router.get('/list', list)
// 添加轮播图
router.put('/add', bannerUpload.single('banner'), testAdd, add)
// 删除轮播图
router.delete('/remove/:id', testId, remove)
// 获取一条轮播图信息
router.get('/info/:id', testId, info)
// 修改轮播图信息
router.patch('/update', bannerUpload.single('banner'), testAdd, testId, update)
module.exports = router